// This is the main DLL file.

#include "stdafx.h"
#include <msclr\marshal.h>
#include "cimgwrapper.h"
using namespace convertor;
using namespace msclr::interop;
namespace ManagedCIMG{

	Bitmap^ ManagedCImg::ToBitmap()
	{
		return (conv->CreateBitmapFromCImg(*img));
	}
	//TODO:implement you method like this.
	void ManagedCImg::ToGray(float Value,bool soft_thresold,bool strict_threshold)
	{
		img->threshold(Value,soft_thresold,strict_threshold);			//same way like this.
	}
	//TODO:Blur
	void ManagedCImg::Blur(float sigma,bool boundarycondition,bool is_gaussian)
	{
		img->blur(sigma,boundarycondition,is_gaussian);
	}
	void ManagedCImg::DrawText(int x,int y,String^ text,int color[])
	{
		
		char* unmanagedstring=(char*)(void*)Marshal::StringToHGlobalAnsi(text);
		unsigned char purple[]={255,0,255};
		img->draw_text(100,100,unmanagedstring,purple);
	}
	void ManagedCImg::Display()
	{
		img->display("display window");
	}
	ManagedCImg::~ManagedCImg()
	{
		img->~CImg();
		delete img;
	};

	int ManagedCImg::getCImgVersion()
	{
		return cimg_version;
	}
}